feat: monitoring retention policy and ingest hardening (#540, #543)#739
feat: monitoring retention policy and ingest hardening (#540, #543)#7392witstudios wants to merge 6 commits intomasterfrom
Conversation
… security_audit_log (#540) Add time-based retention cleanup for monitoring tables that previously grew unbounded. Defaults: api_metrics 90d, system_logs 30d, security_audit_log 365d. Configurable via RETENTION_*_DAYS env vars. Integrated into existing runRetentionCleanup pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation (#543) Redact query parameters from URLs before storage in api_metrics and system_logs. Sanitize ingest payloads (truncate error/stack/userAgent, clamp duration, strip query field). Downgrade missing MONITORING_INGEST_KEY from error to warning for graceful degradation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The runRetentionCleanup function now returns 12 results (9 original + 3 monitoring tables) after integrating monitoring retention cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Export IngestPayload from ingest-sanitizer.ts and import in route.ts, eliminating the duplicate 25-line interface definition - Hoist sanitizeEndpoint() and getRequestSize() before try/catch in monitoring middleware, removing redundant calls in the error handler
The three DB operations (writeApiMetrics, insert systemLogs, writeError) are independent and can run concurrently via Promise.all, reducing per-request latency from sequential X+Y+Z to max(X,Y,Z).
Summary
api_metrics90d,system_logs30d,security_audit_log365d — configurable viaRETENTION_*_DAYSenv varsMONITORING_INGEST_KEYrunRetentionCleanuppipelinePromise.all)workflowsto full-page route pattern in dashboard layoutChanges
packages/lib/src/compliance/retention/monitoring-retention.ts— new retention cleanup functions for api_metrics, system_logs, security_audit_logpackages/lib/src/compliance/retention/retention-engine.ts— integrated monitoring retention into unified cleanup pipelineapps/web/src/lib/monitoring/ingest-sanitizer.ts— URL redaction, payload sanitization (truncation, clamping, query stripping)apps/web/src/middleware/monitoring.ts— apply endpoint sanitization, remove query from payloadsapps/web/src/app/api/internal/monitoring/ingest/route.ts— apply sanitizer, parallelize DB writes, improve missing key handlingapps/web/src/app/dashboard/DashboardLayoutClient.tsx— add workflows to full-page route regexTest plan
checkMCPPageScopemock issue)